<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<base href="__STATIC__/">
<link href="css/bkg_ui.css" type="text/css"  rel="stylesheet" />
<link href="font/css/font-awesome.min.css"  rel="stylesheet" type="text/css" />
<script src="js/jquery-1.9.1.min.js" type="text/javascript" ></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.js" type="text/javascript"></script>
<script src="js/respond.min.js"></script>
<script src="js/css3-mediaqueries.js"  type="text/javascript"></script>
  <![endif]-->
<title>添加产品</title>
</head>

<body>
<form action="{:url('yang/add_goods_do')}" method="post" enctype="multipart/form-data">
    <div class="margin inside_pages clearfix">
        <div class="add_style clearfix relative">
            <ul>
                <li class="clearfix"><label class="label_name col-xs-1"><i>*</i>商品名称：&nbsp;&nbsp;</label><div class="Add_content col-xs-11"><input name="g_name" type="text"  class="col-xs-6"/></div>
                </li>
                <li class="clearfix"><label class="label_name col-xs-1"><i>*</i>商品描述：&nbsp;&nbsp;</label><div class="Add_content col-xs-11"><input name="g_info" type="text" class="col-xs-4"/></div>
                </li>
                <li class="clearfix"><label class="label_name col-xs-1"><i>*</i>商品详情：&nbsp;&nbsp;</label><div class="Add_content col-xs-11"><input name="g_desc" type="text"  class="col-xs-6"/></div>
                </li>
                <li class="clearfix"><label class="label_name col-xs-1"><i>*</i>商品品牌：&nbsp;&nbsp;</label><div class="Add_content col-xs-11">
                    <select name="b_id">
                        <?php foreach($brand_data as $val){?>
                        <option value="<?= $val['b_id']?>"><?= $val['b_name']?></option>
                        <?php }?>
                    </select>
                </li>
                <li class="clearfix aa" id="type1">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>商品分类：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <select name="g_type" id="g_type">
                                <option value="0" selected="selected">请选择分类:</option>
                                <?php foreach($type_data as $val){?>
                                <option value="<?= $val['c_id']?>"> <?php echo str_repeat('&nbsp;&nbsp;&nbsp;',$val['level']);?><?= $val['c_name']?></option>
                                <?php }?>
                            </select>
                        </div>
                    </div>
                </li>
                <li class="clearfix" id="attr">
                </li>
                <li class="clearfix">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>属性价格：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <input name="attr_value_price" type="text"  class="col-xs-7"/>
                        </div>
                    </div>
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>商品库存：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <input name="ku" type="text"  class="col-xs-7"/>
                        </div>
                    </div>
                </li>
                <li class="clearfix"><label class="label_name col-xs-1"><i>*</i>商品底价：&nbsp;&nbsp;</label><div class="Add_content col-xs-11"><input name="g_price" type="text" class="col-xs-4"/></div>
                </li>
                <li class="clearfix"><label class="label_name col-xs-1"><i>*</i>商品排序：&nbsp;&nbsp;</label><div class="Add_content col-xs-11"><input name="g_sort" type="text" class="col-xs-4"/></div>
                </li>
                <li class="clearfix">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>是否上架：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <label><input type="radio" name="g_state" class="ace" checked="checked" value="1"><span class="lbl">是</span></label>
                            <label><input type="radio" name="g_state" class="ace" value="0"><span class="lbl">否</span></label>
                        </div>
                    </div>

                </li>
                <li class="clearfix">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>是否热卖：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <label><input type="radio" name="is_hot" class="ace" checked="checked" value="1"><span class="lbl">是</span></label>
                            <label><input type="radio" name="is_hot" class="ace" value="0"><span class="lbl">否</span></label>
                        </div>
                    </div>

                </li>
                <li class="clearfix">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>是否特价：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <label><input type="radio" name="is_tj" class="ace" checked="checked" value="1" id="is"><span class="lbl">是</span></label>
                            <label><input type="radio" name="is_tj" class="ace" value="0" id="no"><span class="lbl">否</span></label>
                        </div>
                    </div>
                </li>
                <li class="clearfix" id="tj">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>特卖价格：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <input name="tj_price" type="text"  class="col-xs-7"/>
                        </div>
                    </div>
                </li>
                <li class="clearfix">
                    <div class="col-xs-4">
                        <label class="label_name col-xs-3"><i>*</i>适合性别：&nbsp;&nbsp;</label>
                        <div class="Add_content col-xs-9">
                            <label><input type="radio" name="g_sex" class="ace" checked="checked" value="1"><span class="lbl">男</span></label>
                            <label><input type="radio" name="g_sex" class="ace" value="2"><span class="lbl">女</span></label>
                        </div>
                    </div>
                </li>
                <li class="clearfix">
                    <label class="label_name col-xs-1"><i>*</i>产品图片：&nbsp;&nbsp;</label>
                    <div class="Add_content col-xs-11">
                        <div class="images_Upload clearfix margin-bottom">
                            <span class="Upload_img"><input name="g_img" type="file" /></span>
                        </div>
                    </div>
                </li>
            </ul>
            <div class="Button_operation btn_width">
                <!--<button class="btn button_btn bg-deep-blue" type="submit">保存并提交</button>-->
                <input type="submit" class="btn button_btn bg-deep-blue" value="保存并提交">
                <button class="btn button_btn bg-orange" type="button">保存草稿</button>
                <button class="btn button_btn bg-gray" type="button">取消添加</button>
            </div>
        </div>
    </div>
</form>
</body>
</html>
   <!--复文本编辑框-->
    <script type="text/javascript" charset="utf-8" src="js/utf8-jsp/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/utf8-jsp/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="js/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<script>

$(function(){
    $('#g_type').on("change",function(){
        var type_id = $(this).val();
        $.ajax({
            url:"{:url('index/yang/add_goods')}",
            data:{type_id:type_id},
            success:function(e){
                var tr = '';
                $.each(JSON.parse(e),function (v,a) {
                    tr += '<li class="clearfix"><label class="label_name col-xs-1"><i>*</i><input type="hidden" value="'+a.attr_id+'" name="attr_id">'+a.attr_name+'：&nbsp;&nbsp;</label><div class="Add_content col-xs-11"><input name="attr_value_value" type="radio"/ value="'+a.attr_value_value+'"> '+a.attr_value_value+'</div>';

                });
                $("#type1").next().empty();
                $("#type1").next().append(tr);
            }
        })
    })

   $("#no").on("click",function(){
       var no = $(this).val();
       // alert(no);
       if(no == 0){
           $("#tj").hide();
          // $(this).parents().next().hide();
       }
   })
});

</script>
